package com.shycloud.mido.homework.controller;

import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.shycloud.mido.common.core.util.R;
import com.shycloud.mido.homework.api.vo.MusicRankVO;
import com.shycloud.mido.homework.api.vo.MusicSummaryStatisticVO;
import com.shycloud.mido.homework.service.StatisticsService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;


/**
 * @author Xiaoxing Yu
 * @date 2020/11/9 11:26 上午
 **/

@Api(tags = "作业数据统计接口")
@RestController
@AllArgsConstructor
@RequestMapping("/data")
public class StatisticsController {

	private StatisticsService statisticsService;

	/**
	 * 获取学生历史弹奏统计数据
	 *
	 * @param studentId 	 @param musicId
	 * @return com.shycloud.mido.common.core.util.R
	 * @author xiaoxing.yu
	 * @date 2020/11/9 1:18 下午
	 */
	@ApiOperation("获取学生历史弹奏统计数据")
	@GetMapping("/getSummary")
	public R getSummaryStatistics(String studentId, Integer musicId) {
		MusicSummaryStatisticVO statisticVO = statisticsService.getSummaryStatistics(studentId, musicId);
		return new R(statisticVO);
	}

	/**
	 * 单曲分数排行
	 *
	 * @param musicId
	 * @return com.shycloud.mido.common.core.util.R
	 * @author xiaoxing.yu
	 * @date 2020/11/9 3:24 下午
	 */
	@ApiOperation("获取单曲弹奏分数排行")
	@GetMapping("/getMusicRank")
	public R getMusicRank(Integer musicId) {
		List<MusicRankVO> rankVOList = statisticsService.getMusicRank(musicId);
		return new R(rankVOList);
	}


//	@ApiOperation("获取作业列表(分页)")
//	@PostMapping("/deleteBatch")
//	public R deleteBatch(@RequestBody List<Integer> idList) {
//
//	}
}
